from selenium import webdriver
from selenium.webdriver import DesiredCapabilities


def phantomjs_url_test(
    url='http://gaia.imilive.cn/share.html?uid=0&videoid=116682377418697098&cc=TG45624'):
    dcap = dict(DesiredCapabilities.PHANTOMJS)
    dcap["phantomjs.page.settings.userAgent"] = (
        "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36"
    )
    # dcap["phantomjs.page.settings.loadImages"] = False
    driver = webdriver.PhantomJS(desired_capabilities=dcap, executable_path='phantomjs.exe')
    driver.get(url)
    video_url = driver.find_element_by_xpath("//video/@src")
    driver.quit()
    return video_url
phantomjs_url_test()